const Koa = require("koa");

const fs = require("fs");

const app = new Koa();

const logger = require("./logger.js")

app.use(logger);
app.use(async (ctx,next)=>{
    if(fs.existsSync("./logger.txt")){
        if(fs.readFileSync("./logger.txt")){
            console.log("信息成功纪录")
        }
    }
    await next();
})
app.use(async (ctx)=>{
    if(ctx.method === "GET"&&ctx.path === "/user"){
        ctx.body = {
            code:1,
            msg:"asdas"
        }
    }
})



app.listen(3000,()=>{
    console.log("3000端口已开启");
})